﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Ssb
{
    /// <summary>
    /// The Image class is a simple wrapper that contains a single 2D texture & it's coordinates. An Image is like a single-frame Animation.
    /// </summary>
    public class Image
        : DrawableGameComponent
    {
        public Vector2 coords;
        public Vector2 Coords 
        {
            get
            {
                return coords;
            }
            set
            {
                coords = value;
            }
        }

        public float X
        {
            get
            {
                return Coords.X;
            }
            set
            {
                coords.X = value;
            }
        }

        public float Y
        {
            get
            {
                return Coords.Y;
            }
            set
            {
                coords.Y = value;
            }
        }

        public Texture2D texture { get; protected set; }
        public SpriteBatch sb;

        public Image(Game game, Texture2D image, Vector2 position)
            : base(game)
        {
            texture = image;
            coords = position;

            Initialize();
        }

        public override void Initialize()
        {
            sb = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
        }

        public override void Draw(GameTime gt)
        {
            sb.Draw(texture, coords, Color.White);
        }
    }
}
